package com.customer.controller;

import com.customer.feign.UserClient;
import com.customer.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class FeignController {

    @Autowired
    private UserClient userClient;

    @RequestMapping("/queryAllUsers")
    public List<User> queryAllUsers(){
        List<User> allUser = userClient.findAllUser();
        return allUser;
    }

    @RequestMapping("/findUserById/{id}")
    public Map findUserById(@PathVariable("id") Integer id){
       return this.userClient.findUserById(id);
    }
}
